package sort;

import java.util.Arrays;

public class Test {
    public static void testInsert(){
        int[] array = {12,5,2,9,10,7};
        System.out.println("==========插入排序===========");
        System.out.println("排序前：" + Arrays.toString(array));
        Sort.insertSort(array);
        System.out.println("排序后：" + Arrays.toString(array));
    }
    public static void testShell(){
        int[] array = {9,1,2,5,7,4,8,6,3,5};
        System.out.println("==========希尔排序===========");
        System.out.println("排序前：" + Arrays.toString(array));
        Sort.shellSort(array);
        System.out.println("排序后：" + Arrays.toString(array));
    }
    public static void testSelect(){
        int[] array = {9,1,2,5,7,4,8,6,3,5};
        System.out.println("==========选择排序===========");
        System.out.println("排序前：" + Arrays.toString(array));
        Sort.shellSort(array);
        System.out.println("排序后：" + Arrays.toString(array));
    }

    public static void testHeap(){
        int[] array = {9,1,2,5,7,4,8,6,3,5};
        System.out.println("==========堆排序===========");
        System.out.println("排序前：" + Arrays.toString(array));
        Sort.heapSort(array);
        System.out.println("排序后：" + Arrays.toString(array));
    }
    public static void testBubble(){
        int[] array = {9,1,2,5,7,4,8,6,3,5};
        System.out.println("==========冒泡排序===========");
        System.out.println("排序前：" + Arrays.toString(array));
        Sort.bubbleSort(array);
        System.out.println("排序后：" + Arrays.toString(array));
    }
    public static void testQuick(){
        int[] array = {9,1,2,5,7,4,8,6,3,5};
        System.out.println("==========快速排序===========");
        System.out.println("排序前：" + Arrays.toString(array));
        Sort.quickSort(array);
        System.out.println("排序后：" + Arrays.toString(array));
    }

    public static void testMerge(){
        int[] array = {9,1,2,5,7,4,8,6,3,5};
        System.out.println("==========归并排序===========");
        System.out.println("排序前：" + Arrays.toString(array));
        Sort.mergeSort(array);
        System.out.println("排序后：" + Arrays.toString(array));
    }

    public static void testCount(){
        int[] array = {1,2,3,3,5,6,5,7,8,1,4,3,2,9,1,2,5,7,4,8,6,3,5};
        System.out.println("==========计数排序===========");
        System.out.println("排序前：" + Arrays.toString(array));
        Sort.countSort(array);
        System.out.println("排序后：" + Arrays.toString(array));
    }

    public static void main(String[] args) {
        testInsert();
        testShell();
        testSelect();
        testHeap();
        testBubble();
        testQuick();
        testMerge();
        testCount();
    }
}
